 
#include<iostream>
#include<cstdio>
#include<vector>
using namespace std;
#define MAX 100100

vector<int> A[MAX];
int K[MAX];
int cnt[MAX];

int main() {
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) {
        scanf("%d", &K[i]);
        int x;
        for (int j = 1; j <= K[i]; ++j) {
            scanf("%d", &x);
            A[i].push_back(x);
        }
    }
    
    double maxP = 0;
    for (int i = 1; i <= n; ++i) {
        for (int j = 0; j < K[i]; ++j)
            cnt[A[i][j]] = 0;
            
        for (int j = i + 1; j <= n; ++j) {
            for (int k = 0; k < K[i]; ++k)
                cnt[A[i][k]]++;
                
            long long tot = 0;
            for (int k = 0; k < K[j]; ++k)
                tot += cnt[A[j][k]];
                
            maxP = max(maxP, 1.0 * tot / (1.0 * K[i]) / (1.0 * K[j]));
            
            for (int k = 0; k < K[i]; ++k)
                cnt[A[i][k]] = 0;
        }
    }
    
    printf("%.10lf\n", maxP);
    return 0;
}
 